'''
template -- jinja2

import function:
flask.render_template(template_name_or_list, **context)
flask.render_template_string(source, **context)
flask.get_template_attribute(template_name, attribute)
'''

from flask import Flask, render_template, abort

app = Flask(__name__)

@app.route('/')
def hello_world():
    return 'hello world'

@app.route('/user/<username>')
def user(username):
    if username != 'john':
        abort(401)
        print('Unauthorized, Please login first')

    user_info = {
        'name': 'john',
        'email': '123@aa.com',
        'age': 0,
        'github': '...'
    }
    return render_template('user_info.html', page_tigle='letian\'s info', user_info = user_info)
 
if __name__ == '__main__':
    app.run(port=5000, debug=True)